package kr.saeildamil.androidstudy.ch08;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.text.method.Touch;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

public class HandleEvent extends Activity implements View.OnTouchListener{
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		 /* MyView myview = new MyView(this); setContentView(myview);*/
		View v = new View(this);
		v.setOnTouchListener(this);
		setContentView(v);
	} // end of onCreate;

	@Override
	public boolean onTouch(View v, MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			Toast.makeText(
					HandleEvent.this,
					"Point" + event.getX() + "," + event.getY()
							+ "ACTION_DOWN", Toast.LENGTH_SHORT).show();
			return true; // 좌표를 출력해 줌;
		} else if (event.getAction() == MotionEvent.ACTION_UP) {
			Toast.makeText(HandleEvent.this, "ACTION_UP",
					Toast.LENGTH_SHORT).show();
		}
		return false;
	}
	
	/*TouchListenerClass listener = new TouchListenerClass();
	

	public class TouchListenerClass implements View.OnTouchListener {

		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getAction() == MotionEvent.ACTION_DOWN) {
				Toast.makeText(
						HandleEvent.this,
						"Point" + event.getX() + "," + event.getY()
								+ "ACTION_DOWN", Toast.LENGTH_SHORT).show();
				return true; // 좌표를 출력해 줌;
			} else if (event.getAction() == MotionEvent.ACTION_UP) {
				Toast.makeText(HandleEvent.this, "ACTION_UP",
						Toast.LENGTH_SHORT).show();
			}
			return false;
		} // end of method onTouch;
	} // end of class TouchListenerClass;
*/
	/*public class MyView extends View {

		public MyView(Context context) {
			super(context);
		} // end of MyView;

		@Override
		public boolean onTouchEvent(MotionEvent event) {
			super.onTouchEvent(event);
			float x = event.getX();
			float y = event.getY();

			if (event.getAction() == MotionEvent.ACTION_DOWN) {
				Toast.makeText(
						HandleEvent.this,
						"Point" + event.getX() + "," + event.getY()
								+ "ACTION_DOWN", Toast.LENGTH_SHORT).show();
				return true; // 좌표를 출력해 줌;
			} else if (event.getAction() == MotionEvent.ACTION_UP) {
				Toast.makeText(HandleEvent.this, "ACTION_UP",
						Toast.LENGTH_SHORT).show();
			}
			return false;
		} // end of method onTouchEvent;

	} // end of class MyView;
*/
}
